package com.example.aircraftwar2024.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;


import com.example.aircraftwar2024.ActivityManager;
import com.example.aircraftwar2024.R;

public class OfflineActivity extends AppCompatActivity {

    public static String gameMode;
    public static int musicState;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_offline);

        ActivityManager activityManager= ActivityManager.getActivityManager();
        activityManager.addActivity(this);

        //musicState默认值为0,关闭音乐
         musicState = getIntent().getIntExtra("musicState",0);

        Button btnEasy=(Button) findViewById(R.id.btnEasy);
        Button btnMedium=(Button) findViewById(R.id.btnMedium);
        Button btnHard=(Button) findViewById(R.id.btnHard);

        btnEasy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gameMode="Easy Game";

                Intent intent=new Intent(OfflineActivity.this, GameActivity.class);
                intent.putExtra("gameMode",0);
                startActivity(intent);
            }
        });

        btnMedium.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gameMode="Medium Game";
                Intent intent=new Intent(OfflineActivity.this, GameActivity.class);
                intent.putExtra("gameMode",1);
                startActivity(intent);
            }
        });

        btnHard.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gameMode="Hard Game";
                Intent intent=new Intent(OfflineActivity.this, GameActivity.class);
                intent.putExtra("gameMode",2);
                startActivity(intent);
            }
        });
    }
}